﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataAccessLayer
{
    public class CatalogueDAL
    {
        StationeryInventoryEntities1 ent;

        public CatalogueDAL()
        {
            ent = new StationeryInventoryEntities1();
        }

        public List<object> getAllStationeryList()
        {
            List<object> obj = new List<object>();
            var sList = (from s in ent.Stationeries
                         join c in ent.Categories on s.CategoryID equals c.CategoryID
                         select new { s.ItemName, c.CategoryName, s.UOM, s.AvailableQty });
            obj = sList.ToList<object>();
            return obj;
        }

        public List<object> getAllStationeryListByCatID(int catID)
        {
            List<object> obj = new List<object>();

            var sList = (from s in ent.Stationeries
                         join c in ent.Categories on s.CategoryID equals c.CategoryID
                         where s.CategoryID == catID
                         select new { s.ItemName, c.CategoryName, s.UOM, s.AvailableQty });
            obj = sList.ToList<object>();
            return obj;
        }


    }
}
